﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


class GCD
{
    static void Main()
    {
        Console.Write("Enter A: ");
        int a = Convert.ToInt32(Console.ReadLine());
        Console.Write("Enter B: ");
        int b = Convert.ToInt32(Console.ReadLine());
        while (a != b) 
        {
            if (a > b)
            {
                a = a - b;
            }
            else 
            {
                b = b - a;
            }
        }
        Console.WriteLine(a);
    }
}

